package com.supreme.studyserver.thread;

import com.supreme.studyserver.lambda.LoopProcessor;

import java.util.concurrent.Callable;

public class CallableThread implements Callable<Integer> {

    private LoopProcessor loopProcessor;
    private int count = 10;

    public CallableThread(LoopProcessor loopProcessor, int count) {
        this.count = count;
        this.loopProcessor = loopProcessor;
    }

    @Override
    public Integer call() throws Exception {
        if (loopProcessor != null) {
            loopProcessor.simpleLooper(this.count);
        }

        return this.count;
    }
}
